Skip to content

Conversation

@kenchou
Copy link
Owner

@kenchou kenchou commented Jul 8, 2025

No description provided.

@kenchou kenchou requested a review from Copilot July 8, 2025 08:43
@kenchou kenchou merged commit 3b6b1ed into main Jul 8, 2025
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances directory monitoring by adding support for detecting directory creation events and simplifying the fswatch branch.

  • inotifywait now watches for both moved_to and create events and distinguishes between directory creation and move events.
  • Event parsing logic for inotifywait has been refined to separately report create vs. move directory events.
  • fswatch branch logic simplified to treat any detected directory path as a directory event.
Comments suppressed due to low confidence (1)

monitor-dir.sh:100

  • You've added create event handling in the inotifywait invocation—consider adding automated tests or integration checks to verify that directory creation events are correctly detected and reported.
    inotifywait --exclude '(.tmp)' -r -m --format '%w%f %e' -e moved_to,create "$@" | while IFS= read -r line; do

Comment on lines +104 to +109
if [[ "$line" == *"CREATE,ISDIR"* ]] || [[ "$line" == *"MOVED_TO,ISDIR"* ]]; then
# 使用更安全的方式解析路径和事件
# 找到最后一个空格的位置,分离路径和事件
event_part="${line##* }"
path_part="${line% *}"

echo "检测到目录移动事件: $path_part"
if [[ "$line" == *"CREATE,ISDIR"* ]]; then
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current string match assumes a fixed event order (CREATE,ISDIR or MOVED_TO,ISDIR). It would be more robust to split event_part on commas and check for the presence of CREATE/MOVED_TO and ISDIR independently, handling any order or additional flags.

Copilot uses AI. Check for mistakes.
@kenchou kenchou deleted the feature/dir-create branch July 8, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant